<?php
class Model_Extension extends CI_Model {
	public function getInstalled($type) {
		$extension_data = array();
		
		$query = $this->db->query("SELECT * FROM " . $this->db->dbprefix . "extension WHERE `type` = " . $this->db->escape($type) . "");
		
		foreach ($query->result_array() as $result) {
		
			$extension_data[] = $result['code'];
		}
		
		
		
		return $extension_data;
	}
	
	public function install($type, $code) {
		$this->db->query("INSERT INTO " . $this->db->dbprefix . "extension SET `type` = " . $this->db->escape($type) . ", `code` = " . $this->db->escape($code) . "");
	}
	
	public function uninstall($type, $code) {
		$this->db->query("DELETE FROM " . $this->db->dbprefix . "extension WHERE `type` = " . $this->db->escape($type) . " AND `code` = " . $this->db->escape($code) . "");
	}
}
?>